<?php

class SystemAsset
{
    public static function toUrl($asset)
    {
        if(($pos=strrpos($asset,'.'))===false)
            throw new CException('unknown system asset '.$asset);
        
        $suffix=substr($asset,$pos+1);
        if($suffix=='js'){
            return Yii::app()->params->systemAsset['jsBaseUrl'].$asset;
        }
        else if($suffix=='css'){
            return Yii::app()->params->systemAsset['cssBaseUrl'].$asset;
        }
        else {
            return Yii::app()->params->systemAsset['sysImageBaseUrl'].$asset;
        }
    }
}
?>